/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package exercicio_55;

import java.net.*;
import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author manelv8
 */
public class Exc55 {

    public static void main(String[] args) {

     //   Socket socket = new Socket();

     //   InetSocketAddress isa = new InetSocketAddress("www3.virtual.ufc.br", 80);
        /*
         * "http://computing.dcu.ie/~humphrys/howtomailme.html" try { URL url =
         * new URL("www.pudim.com.br" );
         *
         * BufferedReader in = new BufferedReader(new
         * InputStreamReader(url.openStream())); String str;
         *
         * while ((str = in.readLine()) != null) { System.out.println(str); }
         *
         * in.close(); } catch (MalformedURLException e) {} catch (IOException
         * e) {}
         *
         *
         */

        try {
            
             Socket socket = new Socket("www3.virtual.ufc.br",80);
           



            BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
            String request = "GET index.html HTML/1.1 \r\n";
            bw.write(request);
            
            String linha = br.readLine();
            while ((linha) != null) {

                System.out.println(linha);
            }
                    
        } catch (IOException ex) {
            Logger.getLogger(Exc55.class.getName()).log(Level.SEVERE, null, ex);
        }




    }
}
